package com.future.account.controller;

import com.future.account.client.EmailInfoClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 账号信息控制器
 *
 * @author shiyong
 * 2021/7/27 8:02
 */
@RestController
@RequestMapping("/accountInfo")
public class AccountInfoController {

    @Resource
    private EmailInfoClient emailInfoClient;

    /**
     * 添加账号
     *
     * @param accountName 账号名称
     * @return java.lang.String
     * @author shiyong
     * 2021/7/27 8:04
    */
    @PostMapping("/addAccount")
    public String addAccount(String accountName) {
        // 创建账号
        // ......

        // 调用邮件服务接口，将账号信息通过邮件发送给客户
        String result = emailInfoClient.sendEmail("tom@163.com");
        result = "账号" + accountName + "已创建，" + result;
        return result;
    }
}
